library(Hmisc)
data<-read.table("BRCA_normalized_mrnaSEQv2.txt",head=T,sep="\t",quote="")
data<-as.matrix(data)
data[1:10]
data[1:10,1:10]
spearman<-rcorr(data,type="spearman")
hc<-hclust(as.dist(1-spearman$r),"ave")
library("gplots")
library("heatmap.plus")
color.matrix<-read.table("input_colordata.txt",head=TRUE,sep="\t")
dim(color.matrix)
color.matrix[1:2,1:5[
color.matrix[1:2,1:5]
dim(data)
clab<-matrix(as.character(t(color.matrix)),nrow=dim(color.matrix)[2],ncol=dim(color.matrix)[1])
colnames(clab)<-rownames(color.matrix)
pdf("output.pdf", width=18, height=18)
heatmap.plus(spearman$r,ColSideColors=clab,RowSideColors=clab,cexRow=0.5,cexCol=0.5,scale="none",Colv=as.dendrogram(hc),col=greenred(256),Rowv=as.dendrogram(hc),main="With Clustering")
dim(color.matrix)
table(color.matrix[1,1:957])
table(color.matrix[2,1:957])
dim(spearman$r)
dev.off()
pdf("output.pdf", width=18, height=18)
dev.off()
color.matrix<-read.table("input_colordata.txt",head=TRUE,sep="\t",stringsAsFactors =FALSE)
clab<-matrix(as.character(t(color.matrix)),nrow=dim(color.matrix)[2],ncol=dim(color.matrix)[1])
colnames(clab)<-rownames(color.matrix)
dev.off()
pdf("output.pdf", width=18, height=18)
heatmap.plus(spearman$r,ColSideColors=clab,RowSideColors=clab,cexRow=0.5,cexCol=0.5,scale="none",Colv=as.dendrogram(hc),col=greenred(256),Rowv=as.dendrogram(hc),main="With Clustering")
getwd()
dev.off()
color.matrix<-read.table("input_colordata.txt",head=TRUE,sep="\t")
pdf("output.pdf", width=18, height=18)
clab<-matrix(as.character(t(color.matrix)),nrow=dim(color.matrix)[2],ncol=dim(color.matrix)[1])
colnames(clab)<-rownames(color.matrix)
heatmap.plus(spearman$r,ColSideColors=clab,RowSideColors=clab,cexRow=0.5,cexCol=0.5,scale="none",Colv=as.dendrogram(hc),col=greenred(256),Rowv=as.dendrogram(hc),main="With Clustering")
color.matrix[1:2,1:5]
dim(color.matrix)
data[1:2,1:5]
color.matrix<-read.table("input_colordata.txt",head=TRUE,sep="\t")
dim(color.matrix)
color.matrix[1:2,1:5]
dev.off()
data<-read.table("BRCA_normalized_mrnaSEQv2.txt",head=T,sep="\t",quote="")
dim(data)
data<-as.matrix(data)
spearman<-rcorr(data,type="spearman")
hc<-hclust(as.dist(1-spearman$r),"ave")
color.matrix<-read.table("input_colordata.txt",head=TRUE,sep="\t")
clab<-matrix(as.character(t(color.matrix)),nrow=dim(color.matrix)[2],ncol=dim(color.matrix)[1])
colnames(clab)<-rownames(color.matrix)
dev.off()
pdf("output.pdf", width=18, height=18)
heatmap.plus(spearman$r,ColSideColors=clab,RowSideColors=clab,cexRow=0.5,cexCol=0.5,scale="none",Colv=as.dendrogram(hc),col=greenred(256),Rowv=as.dendrogram(hc),main="With Clustering")
dev.off()
getwd()
pdf("output.pdf", width=40, height=40)
heatmap.plus(spearman$r,ColSideColors=clab,RowSideColors=clab,cexRow=0.3,cexCol=0.3,scale="none",Colv=as.dendrogram(hc),col=greenred(256),Rowv=as.dendrogram(hc),main="With Clustering")
dev.off()
pdf("output.pdf", width=60, height=60)
heatmap.plus(spearman$r,ColSideColors=clab,RowSideColors=clab,cexRow=0.2,cexCol=0.2,scale="none",Colv=as.dendrogram(hc),col=greenred(256),Rowv=as.dendrogram(hc),main="With Clustering")
dev.off()
getwd()
pdf("output.pdf", width=60, height=60)
heatmap.plus(spearman$r,ColSideColors=clab,RowSideColors=clab,cexRow=0.2,cexCol=0.2,scale="none",Colv=as.dendrogram(hc),col=greenred(256),Rowv=as.dendrogram(hc),main="With Clustering")
dev.off()
rownames(spearman$r)[1:4]
colnames(spearman$r)[1:4]
write.table("batch_effects.txt",spearman$r,sep="\t",col.names=T,row.names=T)
write.table(spearman$r,"batch_effects.txt",sep="\t",col.names=T,row.names=T)
data_tumor_normal<-read.table("BRCA_normalized_mrnaSEQv2_tumor_normal_only.txt",head=T,sep="\t",quote="")
data_tumor_normal<-read.table("BRCA_normalized_mrnaSEQv2_tumor_normal_only.txt",head=T,sep="\t",quote="")
data_tumor_normal<-read.table("BRCA_normalized_mrnaSEQv2_tumor_normal_only.txt",head=T,sep="\t",quote="")
dim(data_tumor_normal)
data_tumor_normal[2,1]
data_tumor_normal[2,1:3]
data["100133144",]
data_tumor_normal[2,"TCGA.GM.A3NY.01A"]
data_tumor_normal[2,"TCGA-GM-A3NY-01A"]
data_tumor_normal[2,]
data_tumor_normal["100133144","TCGA.GM.A3NY.01A"]
data_tumor_normal["100133144","TCGA.GI.A2C9.11A"]
data["100133144",]
data_tumor_normal["100133144","TCGA.GI.A2C9.11A"]
data_tumor_normal<-read.table("BRCA_normalized_mrnaSEQv2_tumor_normal_only.txt",head=T,sep="\t",quote="")
data_tumor_normal["100133144","TCGA.GI.A2C9.11A"]
data_tumor_normal<-read.table("BRCA_normalized_mrnaSEQv2_tumor_normal_only.txt",head=T,sep="\t",quote="")
data_tumor_normal[1:2,1:3]
data<-as.matrix(data)
data_tumor_normal<-as.matrix(data_tumor_normal)
data_tumor_normal[1:2,1:3]
spearman<-rcorr(data,type="spearman")
hc<-hclust(as.dist(1-spearman$r),"ave")
color.matrix<-read.table("input_colordata_tumor_normal.txt",head=TRUE,sep="\t")
dim(color.matrix)
color.matrix[1:2,3:4]
dim(data_tumor_normal)
color.matrix<-read.table("input_colordata_tumor_normal.txt",head=TRUE,sep="\t")
color.matrix[1:2,3:4]
colnames( color.matrix)
rownames( color.matrix)
color.matrix[1:2,3:6]
color.matrix<-read.table("input_colordata_tumor_normal.txt",head=TRUE,sep="\t")
dim(color.matrix)
color.matrix[1:2,3:6]
clab<-matrix(as.character(t(color.matrix)),nrow=dim(color.matrix)[2],ncol=dim(color.matrix)[1])
colnames(clab)<-rownames(color.matrix)
pdf("output_tumor_normal.pdf", width=60, height=60)
heatmap.plus(spearman$r,ColSideColors=clab,RowSideColors=clab,cexRow=0.5,cexCol=0.5,scale="none",Colv=as.dendrogram(hc),col=greenred(256),Rowv=as.dendrogram(hc),main="With Clustering")
dim(clab)
dim(color.matrix)
dim( data_tumor_normal)
spearman<-rcorr(data_tumor_normal,type="spearman")
hc<-hclust(as.dist(1-spearman$r),"ave")
heatmap.plus(spearman$r,ColSideColors=clab,RowSideColors=clab,cexRow=0.5,cexCol=0.5,scale="none",Colv=as.dendrogram(hc),col=greenred(256),Rowv=as.dendrogram(hc),main="With Clustering")
dev.off()
getwd()
getwd()
clab<-matrix(as.character(t(color.matrix)),nrow=dim(color.matrix)[2],ncol=dim(color.matrix)[1])
colnames(clab)<-rownames(color.matrix)
pdf("output_tumor_normal.pdf", width=60, height=60)
heatmap.plus(spearman$r,ColSideColors=clab,RowSideColors=clab,cexRow=0.5,cexCol=0.5,scale="none",Colv=as.dendrogram(hc),col=greenred(256),Rowv=as.dendrogram(hc),main="With Clustering")
 dev.off()
color.matrix<-read.table("input_colordata_tumor_normal.txt",head=TRUE,sep="\t")
clab<-matrix(as.character(t(color.matrix)),nrow=dim(color.matrix)[2],ncol=dim(color.matrix)[1])
colnames(clab)<-rownames(color.matrix)
pdf("output_tumor_normal.pdf", width=60, height=60)
heatmap.plus(spearman$r,ColSideColors=clab,RowSideColors=clab,cexRow=0.5,cexCol=0.5,scale="none",Colv=as.dendrogram(hc),col=greenred(256),Rowv=as.dendrogram(hc),main="With Clustering")
 dev.off()
getwd()
getwd()
setwd("/data4/bsi/RandD/Workflow/TCGA_DATA/Methylation_450/code_merge/")
data<-read.table("BRCA_normalized_450_methylation_tumor_normal_only.txt",head=T,sep="\t",quote="")
data<-as.matrix(data)
spearman<-rcorr(data,type="spearman")
hc<-hclust(as.dist(1-spearman$r),"ave")
data[1:10,]
data[3,]
data<- data[apply(data, 1, function(y) !all(is.na(y))),]
dim(data)
data[3,]
spearman<-rcorr(data,type="spearman")
write.table(spearman$r,"batch_effects.txt",sep="\t",col.names=T,row.names=T)
apply(data, 2, function(y) !all(is.na(y)))[1]
data<- data[,apply(data, 2, function(y) !all(is.na(y)))]
dim(data)
data<-read.table("BRCA_normalized_450_methylation_tumor_normal_only.txt",head=T,sep="\t",quote="")
data<-as.matrix(data)
spearman<-rcorr(data,type="spearman")
hc<-hclust(as.dist(1-spearman$r),"ave")
color.matrix<-read.table("input_colordata_tumor_normal.txt",head=TRUE,sep="\t")
clab<-matrix(as.character(t(color.matrix)),nrow=dim(color.matrix)[2],ncol=dim(color.matrix)[1])
colnames(clab)<-rownames(color.matrix)
pdf("output_tumor_normal.pdf", width=60, height=60)
heatmap.plus(spearman$r,ColSideColors=clab,RowSideColors=clab,cexRow=0.5,cexCol=0.5,scale="none",Colv=as.dendrogram(hc),col=greenred(256),Rowv=as.dendrogram(hc),main="With Clustering")
dev.off()
pdf("output_tumor_normal_nocluster.pdf", width=60, height=60)
heatmap.plus(spearman$r,ColSideColors=clab,RowSideColors=clab,cexRow=0.5,cexCol=0.5,scale="none",Colv=NA,col=greenred(256),Rowv=NA,main="With Clustering")
dev.off()
 dim(color.matrix)
color.matrix[1.1:5]
color.matrix[1,1:5]
color.matrix[2,1:5]
color.matrix[2,1:50]
color.matrix[2,]
pdf("output_tumor_normal.pdf", width=60, height=60)
heatmap.plus(spearman$r,ColSideColors=clab,RowSideColors=clab,cexRow=0.3,cexCol=0.3,scale="none",Colv=as.dendrogram(hc),col=greenred(256),Rowv=as.dendrogram(hc),main="With Clustering")
dev.off()
getwd()
savehistory("plot.R")
